package com.spark.lola.entity.sup;

import java.math.BigDecimal;

import com.baomidou.mybatisplus.annotation.TableName;
import com.spark.lola.entity.ser.SupervisorRemindLog;
import com.spark.lola.support.common.constant.BooleanConstant;
import com.spark.lola.support.common.constant.CommonConstant;
import com.spark.lola.support.common.entity.ShiroUser;
import com.spark.lola.support.common.util.TimeUtil;
import com.spark.lola.support.mybatis.entity.BaseModel;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 供应商
 * </p>
 *
 * @author dengyejun
 * @since 2020-04-24
 */
@TableName("sup_supplier_info")
@ApiModel(value = "供应商", description = "")
public class SupplierInfo extends BaseModel implements Serializable {
    private static final long serialVersionUID = 1L;

    public SupplierInfo() {
        this.no = String.valueOf(System.currentTimeMillis());
    }

    public SupplierInfo(Long id, Long serviceId, Integer version) {
        this.id = id;
        this.serviceId = serviceId;
        this.setVersion(version);
    }

    public SupplierInfo(Long id, Long salesmanId) {
        this.id = id;
        this.salesmanId = salesmanId;
    }


    @ApiModelProperty(value = "预留字段，业务员id")
    private Long salesmanId;

    @ApiModelProperty(value = "业务员")
    @TableField(exist = false)
    private ShiroUser salesman;

    @ApiModelProperty(value = "客服id")
    private Long serviceId;

    @ApiModelProperty(value = "客服")
    @TableField(exist = false)
    private ShiroUser service;

    @ApiModelProperty(value = "编码")
    private String no;

    @ApiModelProperty(value = "名称")
    private String name;

    @ApiModelProperty(value = "联系人")
    private String linkman;

    @ApiModelProperty(value = "手机")
    private String mobile;

    @ApiModelProperty(value = "QQ号码")
    private String qq;

    @ApiModelProperty(value = "邮箱")
    private String email;

    @ApiModelProperty(value = "特殊供货商")
    private Integer isSpecial = BooleanConstant.FALSE;

    @ApiModelProperty(value = "供货总额")
    private BigDecimal sales = BigDecimal.ZERO;

    @ApiModelProperty(value = "供货次数")
    private Integer orderCount = 0;

    @ApiModelProperty(value = "付款总额")
    private BigDecimal orderPayment = BigDecimal.ZERO;

    @ApiModelProperty(value = "供货总重(kg)")
    private BigDecimal weight = BigDecimal.ZERO;

    @ApiModelProperty(value = "提醒次数")
    private Integer remindCount = 0;

    @ApiModelProperty(value = "头像/Logo")
    private String photo;

    @ApiModelProperty(value = "身份证")
    private String card;

    @ApiModelProperty(value = "执照")
    private String license;

    @ApiModelProperty(value = "省市区Ids")
    private String areaIds;

    @ApiModelProperty(value = "省市区")
    private String area;

    @ApiModelProperty(value = "详细地址")
    private String address;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "状态 Y-启用 N-停用")
    private String used = CommonConstant.Y;

    @ApiModelProperty(value = "创建日期")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    @ApiModelProperty(value = "修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updateTime;

    @ApiModelProperty(value = "无活动天数")
    @TableField(exist = false)
    private Integer silence;

    @ApiModelProperty(value = "提醒日志")
    @TableField(exist = false)
    private List<SupervisorRemindLog> supervisorRemindLogList = new ArrayList<>();

    public Integer getSilence() {
        silence = 0;
        if (this.updateTime != null) {
            silence = TimeUtil.diffByDay(this.updateTime, new Date());
        }
        return silence;
    }

    public ShiroUser getSalesman() {
        return salesman;
    }

    public void setSalesman(ShiroUser salesman) {
        this.salesman = salesman;
    }

    public Long getServiceId() {
        return serviceId;
    }

    public void setServiceId(Long serviceId) {
        this.serviceId = serviceId;
    }

    public ShiroUser getService() {
        return service;
    }

    public void setService(ShiroUser service) {
        this.service = service;
    }

    public void setSilence(Integer silence) {
        this.silence = silence;
    }

    public Date getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }

    public BigDecimal getOrderPayment() {
        return orderPayment;
    }

    public void setOrderPayment(BigDecimal orderPayment) {
        this.orderPayment = orderPayment;
    }

    public String getLinkman() {
        return linkman;
    }

    public void setLinkman(String linkman) {
        this.linkman = linkman;
    }

    public Long getSalesmanId() {
        return salesmanId;
    }

    public void setSalesmanId(Long salesmanId) {
        this.salesmanId = salesmanId;
    }

    public String getNo() {
        return no;
    }

    public void setNo(String no) {
        this.no = no;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getQq() {
        return qq;
    }

    public void setQq(String qq) {
        this.qq = qq;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getIsSpecial() {
        return isSpecial;
    }

    public void setIsSpecial(Integer isSpecial) {
        this.isSpecial = isSpecial;
    }

    public BigDecimal getSales() {
        return sales;
    }

    public void setSales(BigDecimal sales) {
        this.sales = sales;
    }

    public Integer getOrderCount() {
        return orderCount;
    }

    public void setOrderCount(Integer orderCount) {
        this.orderCount = orderCount;
    }

    public BigDecimal getWeight() {
        return weight;
    }

    public void setWeight(BigDecimal weight) {
        this.weight = weight;
    }

    public Integer getRemindCount() {
        return remindCount;
    }

    public void setRemindCount(Integer remindCount) {
        this.remindCount = remindCount;
    }

    public String getPhoto() {
        return photo;
    }

    public void setPhoto(String photo) {
        this.photo = photo;
    }

    public String getCard() {
        return card;
    }

    public void setCard(String card) {
        this.card = card;
    }

    public String getLicense() {
        return license;
    }

    public void setLicense(String license) {
        this.license = license;
    }

    public String getAreaIds() {
        return areaIds;
    }

    public void setAreaIds(String areaIds) {
        this.areaIds = areaIds;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getUsed() {
        return used;
    }

    public void setUsed(String used) {
        this.used = used;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public List<SupervisorRemindLog> getSupervisorRemindLogList() {
        return supervisorRemindLogList;
    }

    public void setSupervisorRemindLogList(List<SupervisorRemindLog> supervisorRemindLogList) {
        this.supervisorRemindLogList = supervisorRemindLogList;
    }

    @Override
    public String toString() {
        return "SupplierInfo{" +
                "salesmanId=" + salesmanId +
                ", no='" + no + '\'' +
                ", name='" + name + '\'' +
                ", mobile='" + mobile + '\'' +
                ", qq='" + qq + '\'' +
                ", email='" + email + '\'' +
                ", isSpecial='" + isSpecial + '\'' +
                ", sales=" + sales +
                ", orderCount=" + orderCount +
                ", weight=" + weight +
                ", photo='" + photo + '\'' +
                ", card='" + card + '\'' +
                ", license='" + license + '\'' +
                ", areaIds='" + areaIds + '\'' +
                ", area='" + area + '\'' +
                ", address='" + address + '\'' +
                ", remark='" + remark + '\'' +
                ", used='" + used + '\'' +
                ", createTime=" + createTime +
                ", id=" + id +
                '}';
    }
}
